import numpy as np
from PIL import Image


def set_chinese():
    import matplotlib
    matplotlib.rcParams['font.sans-serif'] = ['SimHei']
    matplotlib.rcParams['axes.unicode_minus'] = False


def get_image(image):
    # 将图片读入并转为灰度图像并转为numpy矩阵
    gray_img = np.asarray(Image.open(image).convert('L'))
    return gray_img
